package com.neu.icloud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.icloud.entity.WorkOrder;
import com.neu.icloud.service.WorkOrderService;

@RestController
@RequestMapping("/WorkOrderController")
public class WorkOrderController {

	@Autowired
	private WorkOrderService workService;
	
	//查询全部工单
	@RequestMapping("/selectAllWork")
	public List<WorkOrder> selectAllWork() throws Exception{
		return workService.selectAllWork();
	}
	
	//根据计划id查询工单状态
	@RequestMapping("/selectByPlanId")
	public List<String> selectByPlanId(Integer planId) throws Exception{
		return workService.selectByPlanId(planId);
	}

	
	//新增工单
	@RequestMapping("/saveWorkOrder")
	public int saveWorkOrder(WorkOrder workOrder) throws Exception{
		return workService.saveWorkOrder(workOrder);
	}
	
	//修改工单
	@RequestMapping("/updateWorkOrder")
	public int updateWorkOrder(WorkOrder workOrder) throws Exception{
		return workService.updateWorkOrder(workOrder);
	}
	
	//删除工单
	@RequestMapping("/deleteWorkOrder")
	public int deleteWorkOrder(String workOrderId) throws Exception{
		return workService.deleteWorkOrder(workOrderId);
	}
}
